import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/login',
    method: 'post',
    data
  })
}
// 新增
export function createCustomer(data) {
  return request({
    url: '/customer',
    method: 'post',
    data
  })
}

// 待审核列表
export function pendingApprovalList(data) {
  return request({
    url: '/customer/pending-approval',
    method: 'post',
    data
  })
}

// 审批
export function customerPending(data) {
  return request({
    url: '/customer/pending',
    method: 'post',
    data
  })
}

// 客户管理
export function customerList(data) {
  return request({
    url: '/customer/page',
    method: 'post',
    data
  })
}

// 业务员
export function usersByRole(roleId) {
  return request({
    url: `/role/users/${roleId}`,
    method: 'GET'
  })
}

// 模板
export function priceTemplate() {
  return request({
    url: `/price-template`,
    method: 'GET'
  })
}

// 设置余额
export function customerUpdateBalance(data) {
  return request({
    url: `/customer/update-balance`,
    method: 'POST',
    data
  })
}

// 设置业务员
export function customerUpdateSales(data) {
  return request({
    url: `/customer/update-sales`,
    method: 'POST',
    data
  })
}

// 删除客户
export function customerDelete(ids) {
  return request({
    url: `/customer/${ids}`,
    method: 'DELETE'
  })
}

// 搜索客户
export function customerSearch(key) {
  return request({
    url: `/customer/search/${key}`,
    method: 'GET'
  })
}

